package main

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

func main() {
	a := []map[]{1, 2, 3, 4, 5, 6, 7, nil, 8, 9, nil, 10, 11, nil, 12}
	root := createBinaryTree(a)
	print(root)
}

func createBinaryTree(nums []int) TreeNode {
	if len(nums) < 1 {
		return TreeNode{}
	}
	root := TreeNode{Val: nums[0]}
	nums = nums[1:]
	queue := []TreeNode{root}
	for ; len(nums) > 1; {
		tem := queue[0]
		queue = queue[1:]
		//if nums[0] != nil{
		//	temL := TreeNode{Val: nums[0]}
		//	tem.Left = &temL
		//} else {
		//	tem.Left = nil
		//}
		//if nums[0] != nil {
		//	temR := TreeNode{Val: nums[0]}
		//	tem.Right = &temR
		//} else {
		//	tem.Right = nil
		//}
		print(tem)
	}
	return root
}
